Lightweight Family Polymorphism
نویسندگان
چکیده
Family polymorphism has been proposed for object-oriented languages as a solution to supporting reusable yet type-safe mutually recursive classes. A key idea of family polymorphism is the notion of families, which are used to group mutually recursive classes. In the original proposal, due to the design decision that families are represented by objects, dependent types had to be introduced, resulting in a rather complex type system. In this paper, we propose a simpler solution of lightweight family polymorphism, based on the idea that families are represented by classes rather than objects. This change makes the type system significantly simpler without losing much expressibility of the language. Moreover, “family-polymorphic” methods now take a form of parametric methods; thus it is easy to apply the Java-style type inference. To rigorously show that our approach is safe, we formalize the set of language features on top of Featherweight Java and prove the type system is sound. An algorithm of type inference for family-polymorphic method invocations is also formalized and proved to be correct.
منابع مشابه
The Essence of Lightweight Family Polymorphism
The formal core calculus .FJ has been introduced to model lightweight family polymorphism, a programming style to support reusable yet type-safe mutually recursive classes. This paper clarifies the essence of the features of .FJ, by giving a formal translation from .FJ into a variant of Featherweight GJ with a little extension of F-bounded polymorphism. The extension, which allows self types to...
متن کاملLightweight Higher-Kinded Polymorphism
Higher-kinded polymorphism —i.e. abstraction over type constructors— is an essential component of many functional programming techniques such as monads, folds, and embedded DSLs. ML-family languages typically support a form of abstraction over type constructors using functors, but the separation between the core language and the module language leads to awkwardness as functors proliferate. We s...
متن کاملCarrier Determination in a Hemophilia B Family Using Single Strand Conformation Polymorphism (SSCP) and Sequencing
متن کامل
Lightweight Parametric Polymorphism for Oberon
Strongly typed polymorphism is necessary for expressing safe reusable code. Two orthogonal forms of polymorphism exist: inclusion and parametric, the Oberon language only supports the former. We describe a simple extension to Oberon to support parametric polymor-phism. The extension is in keeping with the Oberon language: it is simple and has an explicit cost. In the paper we motivate the need ...
متن کاملMODELING FLEXURAL STRENGTH OF EPS LIGHTWEIGHT CONCRETE USING REGRESSION, NEURAL NETWORK AND ANFIS
Lightweight concrete (LWC) is a kind of concrete that made of lightweight aggregates or gas bubbles. These aggregates could be natural or artificial, and expanded polystyrene (EPS) lightweight concrete is the most interesting lightweight concrete and has good mechanical properties. Bulk density of this kind of concrete is between 300-2000 kg/m3. In this paper flexural strength of EPS is modeled...
متن کامل